using Forecast.Database;
using System;
using System.Collections.Generic;
using System.Text;

namespace Forecast.Business.Test
{
    internal class Mocks
    {
        #region Interface

        internal static Holding GetBuyerHolding()
        {
            Holding holding = new Holding();
            holding.Id = MockIds.BUYER_HOLDING;
            holding.NumPredictions = 10;
            holding.PlayerId = MockIds.BUYER;
            holding.PredictionId = MockIds.PREDICTION;
            return holding;
        }

        internal static Holding GetSellerHolding()
        {
            Holding holding = new Holding();
            holding.Id = MockIds.SELLER_HOLDING;
            holding.NumPredictions = 75;
            holding.PlayerId = MockIds.SELLER;
            holding.PredictionId = MockIds.PREDICTION;
            return holding;
        }

        internal static Player GetSeller()
        {
            Player player = new Player();
            player.Cash = 1500;
            player.Id = MockIds.SELLER;
            player.UserName = "Beelzebub";
            return player;
        }

        internal static Player GetBuyer()
        {
            Player player = new Player();
            player.Cash = 1500;
            player.Id = MockIds.BUYER;
            player.UserName = "Jesus";
            return player;
        }

        internal static Offer GetBuyOffer()
        {
            Offer buyOffer = new Offer();
            buyOffer.EndDate = DateTime.Today.AddDays(2);
            buyOffer.Id = MockIds.BUY_OFFER;
            buyOffer.IsAccepted = false;
            buyOffer.IsActive = true;
            buyOffer.IsBuy = true;
            buyOffer.NumPredictions = 10;
            buyOffer.PlayerId = MockIds.BUYER;
            buyOffer.PredictionId = MockIds.PREDICTION;
            buyOffer.Price = 60;            
            return buyOffer;
        }

        internal static Offer GetSellOffer()
        {
            Offer buyOffer = new Offer();
            buyOffer.EndDate = DateTime.Today.AddDays(4);
            buyOffer.Id = MockIds.SELL_OFFER;
            buyOffer.IsAccepted = false;
            buyOffer.IsActive = true;
            buyOffer.IsBuy = false;
            buyOffer.NumPredictions = 15;
            buyOffer.PlayerId = MockIds.SELLER;
            buyOffer.PredictionId = MockIds.PREDICTION;
            buyOffer.Price = 59;
            return buyOffer;
        }

        internal static Prediction GetPrediction()
        {
            Prediction prediction = new Prediction();
            prediction.EndDate = DateTime.Today.AddDays(180);
            prediction.HasSucceeded = false;
            prediction.Id = MockIds.PREDICTION;
            prediction.IsActive = true;
            prediction.IsClosed = false;
            prediction.LastChange = 0;
            prediction.LastValue = 50;
            prediction.LongDescription = "This is just for unit testing so I dont want to write so much.";
            prediction.ShortDescription = "Not relevant either.";
            prediction.Ticker = "CON";
            return prediction;
        }

        internal static IList<Player> GetAllPlayers()
        {
            IList<Player> players = new List<Player>();
            
            Player one = new Player();
            one.Cash = 500;
            one.Id = 1;
            one.UserName = "One";
            players.Add(one);

            Player two = new Player();
            two.Cash = 500;
            two.Id = 2;
            two.UserName = "Two";
            players.Add(two);

            Player three = new Player();
            three.Cash = 500;
            three.Id = 3;
            three.UserName = "Three";
            players.Add(three);

            Player four = new Player();
            four.Cash = 1000;
            four.Id = 4;
            four.UserName = "Four";
            players.Add(four);

            return players;
        }

        internal static IList<Medal> GetAllMedals()
        {
            IList<Medal> medals = new List<Medal>();

            Medal none = new Medal();
            none.Description = "No medals won.";
            none.Id = MockIds.MEDAL_NONE;
            none.Name = "None";
            medals.Add(none);

            Medal predictum = new Medal();
            predictum.Description = "Most stocks on successful prediction.";
            predictum.Id = MockIds.MEDAL_PREDICTUM;
            predictum.Name = "Predictum";
            medals.Add(predictum);

            Medal fatalum = new Medal();
            fatalum.Description = "Most cash made on selling and buying unsuccessful prediction.";
            fatalum.Id = MockIds.MEDAL_FATALUM;
            fatalum.Name = "Fatalum";
            medals.Add(fatalum);

            return medals;
        }

        internal static IList<Holding> GetAllHoldingsForOnePrediction()
        {
            IList<Holding> holdings = new List<Holding>();

            Holding one = new Holding();
            one.Id = 5;
            one.NumPredictions = 15;
            one.PlayerId = 1;
            one.PredictionId = MockIds.PREDICTION;
            holdings.Add(one);

            Holding two = new Holding();
            two.Id = 10;
            two.NumPredictions = 20;
            two.PlayerId = 2;
            two.PredictionId = MockIds.PREDICTION;
            holdings.Add(two);

            Holding three = new Holding();
            three.Id = 15;
            three.NumPredictions = 75;
            three.PlayerId = 3;
            three.PredictionId = MockIds.PREDICTION;
            holdings.Add(three);

            Holding four = new Holding();
            four.Id = 20;
            four.NumPredictions = 90;
            four.PlayerId = 4;
            four.PredictionId = MockIds.PREDICTION;
            holdings.Add(four);

            return holdings;
        }

        #endregion
    }
}
